<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Parent Details</f:facet>

        <s:decorate id="id" template="layout/display.xhtml">
            <ui:define name="label">Id</ui:define>
            <h:outputText value="#{parentHome.instance.id}"/>
        </s:decorate>

        <s:decorate id="firstName" template="layout/display.xhtml">
            <ui:define name="label">First name</ui:define>
            <h:outputText value="#{parentHome.instance.firstName}"/>
        </s:decorate>

        <s:decorate id="lastName" template="layout/display.xhtml">
            <ui:define name="label">Last name</ui:define>
            <h:outputText value="#{parentHome.instance.lastName}"/>
        </s:decorate>

        <s:decorate id="mobileNumber" template="layout/display.xhtml">
            <ui:define name="label">Mobile number</ui:define>
            <h:outputText value="#{parentHome.instance.mobileNumber}"/>
        </s:decorate>

        <s:decorate id="officePhone" template="layout/display.xhtml">
            <ui:define name="label">Office phone</ui:define>
            <h:outputText value="#{parentHome.instance.officePhone}"/>
        </s:decorate>

        <s:decorate id="email" template="layout/display.xhtml">
            <ui:define name="label">Email</ui:define>
            <h:outputText value="#{parentHome.instance.email}"/>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/ParentEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty parentFrom ? 'ParentList' : parentFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>UserAccount</h:panelGroup>
        </f:facet>
    <div class="association" id="userAccountParent">

        <h:outputText value="There is no userAccount associated with this parent."
                   rendered="#{parentHome.instance.userAccount == null}"/>

        <rich:dataTable var="_userAccount"
                   value="#{parentHome.instance.userAccount}"
                rendered="#{parentHome.instance.userAccount != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="userAccountTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_userAccount.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">UserAccountname</f:facet>
                <h:outputText value="#{_userAccount.username}"/>
            </h:column>
           
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewuserAccount"
                     value="View"
                      view="/UserAccount.xhtml">
                    <f:param name="userAccountId"
                           value="#{_userAccount.id}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Student</h:panelGroup>
        </f:facet>
    <div class="association" id="studentParent">

        <h:outputText value="There is no student associated with this parent."
                   rendered="#{parentHome.instance.student == null}"/>

        <rich:dataTable var="_student"
                   value="#{parentHome.instance.student}"
                rendered="#{parentHome.instance.student != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="studentTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_student.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">UserAccount id</f:facet>
                <h:outputText value="#{_student.userAccount.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Course id</f:facet>
                <h:outputText value="#{_student.course.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">First name</f:facet>
                <h:outputText value="#{_student.firstName}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Last name</f:facet>
                <h:outputText value="#{_student.lastName}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Passport photo url</f:facet>
                <h:outputText value="#{_student.passportPhotoUrl}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Date of birth</f:facet>
                <h:outputText value="#{_student.dateOfBirth}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Register number</f:facet>
                <h:outputText value="#{_student.registerNumber}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Roll number</f:facet>
                <h:outputText value="#{_student.rollNumber}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewstudent"
                     value="View"
                      view="/Student.xhtml">
                    <f:param name="studentId"
                           value="#{_student.id}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Relationship</h:panelGroup>
        </f:facet>
    <div class="association" id="relationshipParent">

        <h:outputText value="There is no relationship associated with this parent."
                   rendered="#{parentHome.instance.relationship == null}"/>

        <rich:dataTable var="_relationship"
                   value="#{parentHome.instance.relationship}"
                rendered="#{parentHome.instance.relationship != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="relationshipTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_relationship.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Relation name</f:facet>
                <h:outputText value="#{_relationship.relationName}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Relation desc</f:facet>
                <h:outputText value="#{_relationship.relationDesc}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewrelationship"
                     value="View"
                      view="/Relationship.xhtml">
                    <f:param name="relationshipId"
                           value="#{_relationship.id}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Address</h:panelGroup>
        </f:facet>
    <div class="association" id="addressParent">

        <h:outputText value="There is no address associated with this parent."
                   rendered="#{parentHome.instance.address == null}"/>

        <rich:dataTable var="_address"
                   value="#{parentHome.instance.address}"
                rendered="#{parentHome.instance.address != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="addressTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_address.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Address line1</f:facet>
                <h:outputText value="#{_address.addressLine1}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Address line2</f:facet>
                <h:outputText value="#{_address.addressLine2}"/>
            </h:column>
            <h:column>
                <f:facet name="header">City</f:facet>
                <h:outputText value="#{_address.city}"/>
            </h:column>
            <h:column>
                <f:facet name="header">State</f:facet>
                <h:outputText value="#{_address.state}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Country</f:facet>
                <h:outputText value="#{_address.country}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Pin</f:facet>
                <h:outputText value="#{_address.pin}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewaddress"
                     value="View"
                      view="/Address.xhtml">
                    <f:param name="addressId"
                           value="#{_address.id}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Student admissions</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="studentAdmissionsChildren">

        <h:outputText value="There are no studentAdmissions associated with this parent."
                   rendered="#{empty parentHome.studentAdmissions}"/>

        <rich:dataTable value="#{parentHome.studentAdmissions}"
                       var="_studentAdmission"
                  rendered="#{not empty parentHome.studentAdmissions}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="studentAdmissionsTable">
            <rich:column sortBy="#{_studentAdmission.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_studentAdmission.id}"/>
            </rich:column>
            <rich:column sortBy="#{_studentAdmission.admissionDate}">
                <f:facet name="header">Admission date</f:facet>
                <h:outputText value="#{_studentAdmission.admissionDate}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </rich:column>
            <rich:column sortBy="#{_studentAdmission.admissionFeeAmount}">
                <f:facet name="header">Admission fee amount</f:facet>
                <h:outputText value="#{_studentAdmission.admissionFeeAmount}"/>
            </rich:column>
            <rich:column sortBy="#{_studentAdmission.specialFeeAmount}">
                <f:facet name="header">Special fee amount</f:facet>
                <h:outputText value="#{_studentAdmission.specialFeeAmount}"/>
            </rich:column>
            <rich:column sortBy="#{_studentAdmission.paymentDate}">
                <f:facet name="header">Payment date</f:facet>
                <h:outputText value="#{_studentAdmission.paymentDate}">
                    <s:convertDateTime type="date" dateStyle="short"/>
                </h:outputText>
            </rich:column>
            <rich:column sortBy="#{_studentAdmission.eligibleForScholarship}">
                <f:facet name="header">Eligible for scholarship</f:facet>
                <h:outputText value="#{_studentAdmission.eligibleForScholarship}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectstudentAdmission"
                     value="Select"
                      view="/StudentAdmission.xhtml">
                    <f:param name="studentAdmissionId"
                            value="#{_studentAdmission.id}"/>
                    <f:param name="studentAdmissionFrom" value="Parent"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add studentAdmission"
                view="/StudentAdmissionEdit.xhtml">
            <f:param name="parentId"
                    value="#{parentHome.instance.id}"/>
            <f:param name="studentAdmissionFrom" value="Parent"/>
        </s:button>
    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Student emergency contacts</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="studentEmergencyContactsChildren">

        <h:outputText value="There are no studentEmergencyContacts associated with this parent."
                   rendered="#{empty parentHome.studentEmergencyContacts}"/>

        <rich:dataTable value="#{parentHome.studentEmergencyContacts}"
                       var="_studentEmergencyContact"
                  rendered="#{not empty parentHome.studentEmergencyContacts}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="studentEmergencyContactsTable">
            <rich:column sortBy="#{_studentEmergencyContact.id}">
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_studentEmergencyContact.id}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectstudentEmergencyContact"
                     value="Select"
                      view="/StudentEmergencyContact.xhtml">
                    <f:param name="studentEmergencyContactId"
                            value="#{_studentEmergencyContact.id}"/>
                    <f:param name="studentEmergencyContactFrom" value="Parent"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add studentEmergencyContact"
                view="/StudentEmergencyContactEdit.xhtml">
            <f:param name="parentId"
                    value="#{parentHome.instance.id}"/>
            <f:param name="studentEmergencyContactFrom" value="Parent"/>
        </s:button>
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
